<template>
  <view class="box">
    <view :style="{ marginTop: topHeight.top + 'px',pointerEvents: `${loadType===1?'none':'auto'}`}">
      <uv-vtabs v-if="productOneList && productOneList.length > 0" :chain="chain" :list="productOneList"
                :height="height"
                ref="productRef"
                bottom-height="144rpx"
                :bar-item-active-line-style="{ background: '#3775F6', height: '40rpx', margin: 'auto', width: '8rpx', borderRadius: '0px 4px 4px 0px' }"
                :bar-item-active-style="{ color: 'rgba(0, 0, 0, 0.9)', fontWeight: 'bold' }"
                :bar-item-style="{ color: 'rgba(0, 0, 0, 0.6)' }" @change="changeTab">

        <z-paging ref="paging" :fixed="false" :style="{height: '100%'}" v-model="goodComList"
                  refresher-complete-delay="500" :auto="false" :scrollable="scrollShow"
                  :show-refresher-when-reload="true" :loading-more-default-as-loading="true"
                  local-paging-loading-time="500" :watch-touch-direction-change="true"
                  cell-height-mode="dynamic" default-page-size="6" :loading-more-enabled="!!scrollShow"
                  :refresher-complete-text="refreshText"
                  :loading-more-no-more-text="moreText" :scroll-to-bottom-bounce-enabled="false"
                  @refresherTouchend="pagIngRefresh" @loadingStatusChange="pagIngLoad"
                  @scrolltolower="pagIngScrollLower" @touchDirectionChange="touchDirectionChange"
                  @refresherStatusChange="pagIngRefreshChange" @onRestore="onRestore"
                  @touchstart="touchStart" @touchend="touchEnd" @touchmove="touchMove"
        >
          <template #top>
            <uv-tabs v-if="productTwoList && productTwoList.length > 0" :list="productTwoList" @click="tabsClick"
                     @change="tabsChange" :current="current" :duration="0"></uv-tabs>
          </template>
          <view class="item" v-for="(goods, k) in goodComList" :id="`zp-id-${goods.zp_index}`" :key="goods.zp_index"
                :ref="goods.id">
            <view class="right-product-box">
              <view class="image-box" @click="goProductDetails(goods)">
                <image :src="goods.url" mode="aspectFill" :lazy-load="true"></image>
              </view>
              <view class="name-box">
                <view class="good-name">
                  <view class="h2" style="width: 60%;">{{ goods.name }}</view>
                  <view class="similar-good" v-if="similarGoods[goods.name]"
                        @click.stop="getSimilarGoodsList(goods.name)">相似商品
                  </view>
                </view>
                <view class="specif-text">{{ goods.spec ? goods.spec : '无规格' }}；{{ goods.goodsUnitName }}</view>
                <view class="specif-text">起订量：{{ goods.orderAmount }}</view>
                <view class="price-box">
                  <view class="price">¥
                    <text>{{ goods.price }}</text>
                  </view>
                  <view v-if="checkGoodsId(goods.id)">
                    <NumberBox v-if="goods" :goods="goods" :orderAmount="goods.orderAmount" :type="goods.unitType"
                               :input-text-ellipsis="true" @numChange="numChange"></NumberBox>
                  </view>
                  <view class="disable-text" v-else>该商品已不能购买</view>
                </view>
              </view>
            </view>
          </view>
        </z-paging>
        <!--        <jp-virtual-list code="id" :style="{height: '100%'}" :refresher="true" :data="goodComList" ref="jvlRef"-->
        <!--                         @scrolltoupper="scrolltoupper" @refresher="refresher" :page-sizes="10">-->
        <!--          <template #tabs>-->
        <!--            <uv-tabs v-if="productTwoList && productTwoList.length > 0" :list="productTwoList" @click="tabsClick"-->
        <!--                     @change="tabsChange" :current="current" :duration="0"></uv-tabs>-->
        <!--          </template>-->
        <!--          <template v-slot="{ list }">-->
        <!--            <view class="item" v-for="(goods, k) in list" :key="k" :id="goods.id" :ref="goods.id">-->
        <!--              <view class="right-product-box">-->
        <!--                <view class="image-box" @click="goProductDetails(goods)">-->
        <!--                  <image :src="goods.url" mode="aspectFill"></image>-->
        <!--                </view>-->
        <!--                <view class="name-box">-->
        <!--                  <view class="good-name">-->
        <!--                    <view class="h2" style="width: 60%;">{{ goods.name }}</view>-->
        <!--                    <view class="similar-good" v-if="similarGoods[goods.name]"-->
        <!--                          @click.stop="getSimilarGoodsList(goods.name)">相似商品-->
        <!--                    </view>-->
        <!--                  </view>-->
        <!--                  <view class="specif-text">{{ goods.spec ? goods.spec : '无规格' }}；{{ goods.goodsUnitName }}</view>-->
        <!--                  <view class="specif-text">起订量：{{ goods.orderAmount }}</view>-->
        <!--                  <view class="price-box">-->
        <!--                    <view class="price">¥-->
        <!--                      <text>{{ goods.price }}</text>-->
        <!--                    </view>-->
        <!--                    <view v-if="checkGoodsId(goods.id)">-->
        <!--                      <NumberBox v-if="goods" :goods="goods" :orderAmount="goods.orderAmount" :type="goods.unitType"-->
        <!--                                 :input-text-ellipsis="true" @numChange="numChange" @fly="fly"></NumberBox>-->
        <!--                    </view>-->
        <!--                    <view class="disable-text" v-else>该商品已不能购买</view>-->
        <!--                  </view>-->
        <!--                </view>-->
        <!--              </view>-->
        <!--            </view>-->
        <!--          </template>-->
        <!--        </jp-virtual-list>-->
      </uv-vtabs>
      <view v-if="emptyVal">
        <view class="tabel-no-data list-no empty-box">
          <uv-empty mode="data" icon="/static/image/no-data.png" width="200rpx" height="260rpx"
                    text="&nbsp;"></uv-empty>
        </view>
      </view>
    </view>
    <l-ball ref="ballRef" v-if="products && products.length > 0">
      <template #default="{ active }">
        <shopping-cart @shoppingCart="openPop" @goOrder="goOrder" :goodsNum="goodsNum"
                       :totalOrderPrice="totalOrderPrice" :class="{ active }"></shopping-cart>
      </template>
    </l-ball>
    <uv-popup ref="popup" round="16rpx" mode="bottom">
      <view class="popup-title">
        <view class="h2">购物车</view>
        <view class="clear-shopping">
          <uv-icon name="trash" color="#949494" size="22"></uv-icon>
          <view class="text" @click="cleanChart">清空购物车</view>
        </view>
      </view>
      <scroll-view :scroll-y="true" class="popup-height">
        <shopping :is-title="false" :product-edit="false" :providerOrgId="providerOrgId"
                  :providerOrgName="providerOrgName" :productList="productList" :overlimitFlag="true"
                  @changeGoodsMap="changeGoodsMap"></shopping>
        <uv-gap height="150rpx"></uv-gap>
      </scroll-view>
    </uv-popup>
  </view>
</template>
<script setup>
import {computed, getCurrentInstance, reactive, ref, watch, watchEffect, onMounted, nextTick} from "vue";
import {onLoad, onReady, onShow} from "@dcloudio/uni-app";
import api from '@/api/school/store/store'
import goodsApi from '@/api/school/goods/goods'
import shoppingCart from '../../components/product/shoppingCart.vue'
import shopping from '../../components/schoolComponents/shopping/index.vue'
import NumberBox from '../../components/numberBox'
import topHeight from "@/common/topHeight";

const {proxy} = getCurrentInstance();
const {shopCartAll, shopCart, useParam} = proxy.store();
import ZPaging from "@/pages/customer/components/z-paging/z-paging.vue";
// import jpVirtualList from "@/pages/customer/components/jp-virtual-list/jp-virtual-list.vue";
// 参数获取
const props = defineProps({
  providerOrgId: {
    required: false,
    type: String,
    default: ''
  },
  providerOrgName: {
    required: false,
    type: String,
    default: ''
  },
  goodsIds: {
    required: false,
    type: Array,
    default: []
  },
});

const popup = ref('');
let emptyVal = ref(false)
let userInfo = uni.getStorageSync("userInfo").user;
// 页面高度
const height = computed(() => uni.getSystemInfoSync().windowHeight - proxy.topHeight.top);
const shoppingCar = ref(null)

const chain = ref(false);


const goodsMap = ref({});
const goodsNum = ref(0);
const totalOrderPrice = ref(0);
const productList = ref([]);
let products = ref([]);   // 商品信息
let provider = reactive({});        // 供应商信息


let checkGoodsId = (id) => {
  return props.goodsIds.indexOf(id) == -1
};

// 店铺信息
let getStoreData = async (e) => {
  uni.showLoading({title: '加载中...', mask: true});
  goodsMap.value = {};
  productList.value = [];
  let form = {};
  form.providerOrgId = props.providerOrgId;
  let res = await proxy.http.asyncPost(api.getStoreData, form, false);     // 获取店铺信息
  if (res.code === 0) {
    Object.assign(provider, res.data.provider)                    // 供应商数据
    let addGoodsList = shopCart.goods[props.providerOrgId];       // 获取缓存数据
    if (addGoodsList != null && addGoodsList.length > 0) {
      addGoodsList.forEach(item => {
        goodsMap.value[item.id] = item;
      });
    }

    products.value = res.data.products;
    // products.value = json
    if (products.value.length <= 0) {
      emptyVal.value = true
    }
    products.value.forEach((product) => {
      product.children.forEach((p) => {
        p.goodsList.forEach(g => {
          if (goodsMap.value[g.id]) {
            g.amount = goodsMap.value[g.id].amount;
            g.orderNextNum = goodsMap.value[g.id].orderNextNum;
            g.showMinus = goodsMap.value[g.id].showMinus;
            g.inputDis = goodsMap.value[g.id].inputDis;
          } else {
            g.amount = null;
            g.orderNextNum = null;
            g.showMinus = false;
            g.inputDis = false;
          }
        })
      })
    });
    goodsNum.value = Object.keys(goodsMap.value).length;
    totalOrderPrice.value = 0;
    productList.value = [];
    Object.keys(goodsMap.value).forEach(key => {
      totalOrderPrice.value = proxy.cal.add(totalOrderPrice.value, proxy.cal.multiply(goodsMap.value[key].price, goodsMap.value[key].amount));
      productList.value.push(goodsMap.value[key]);
    });
    totalOrderPrice.value = Math.round(totalOrderPrice.value * 100) / 100;
    setTimeout(() => {
      uni.hideLoading();
    }, 1000);
  } else {
    setTimeout(() => {
      uni.hideLoading();
    }, 1000);
    uni.showToast({title: res.msg, icon: 'none'});
  }
};
getStoreData();
// 商品改变
let changeGoodsMap = (e, type) => {
  if (type == 'add') {
    goodsMap.value[e.id] = e;
  } else {
    delete goodsMap.value[e.id];
  }
  products.value.forEach((product) => {
    product.children.forEach((p) => {
      p.goodsList.forEach(g => {
        if (g.id == e.id) {
          if (type == 'add') {
            g.amount = e.amount;
            g.orderNextNum = e.orderNextNum;
            g.showMinus = true;
            g.inputDis = true;
          } else {
            g.amount = null;
            g.orderNextNum = null;
            g.showMinus = false;
            g.inputDis = false;
          }
        }
      })
    })
  });
  productList.value = [];
  goodsNum.value = Object.keys(goodsMap.value).length;
  totalOrderPrice.value = 0;
  Object.keys(goodsMap.value).forEach(key => {
    totalOrderPrice.value = proxy.cal.add(totalOrderPrice.value, proxy.cal.multiply(goodsMap.value[key].price, goodsMap.value[key].amount));
    productList.value.push(goodsMap.value[key]);
  });
  totalOrderPrice.value = Math.round(totalOrderPrice.value * 100) / 100;
  shopCart.$patch(state => {
    state.goods[props.providerOrgId] = productList.value;
    state.provider[props.providerOrgId] = props.providerOrgName;
  })
  shopCartAll.$patch(state => {
    state.userMap[userInfo.id] = shopCart;
  })
};


// 商品购物数量改变
let numChange = (e) => {
  if (e.value > 0) {        // 大于0时候判断是否到达最少数量
    if (e.value < e.name.orderAmount) {
      e.name.amount = null;
      e.name.showMinus = false;//计数最小隐藏
      e.name.inputDis = false;//输入框不能输入
      delete goodsMap.value[e.name.id];
    } else {
      //+ //-
      e.name.amount = e.value;
      e.name.showMinus = true;//计数最小隐藏
      e.name.inputDis = true;//输入框不能输入
      goodsMap.value[e.name.id] = e.name;
    }
  } else {
    e.name.amount = null;
    e.name.showMinus = false;//计数最小隐藏
    e.name.inputDis = false;//输入框不能输入
    delete goodsMap.value[e.name.id];
  }

  // 购物商品中
  goodsNum.value = Object.keys(goodsMap.value).length;
  totalOrderPrice.value = 0;
  productList.value = [];
  Object.keys(goodsMap.value).forEach(key => {
    totalOrderPrice.value = proxy.cal.add(totalOrderPrice.value, proxy.cal.multiply(goodsMap.value[key].price, goodsMap.value[key].amount));
    productList.value.push(goodsMap.value[key]);
  });
  totalOrderPrice.value = Math.round(totalOrderPrice.value * 100) / 100;
  // 购物车缓存中
  shopCart.$patch(state => {
    state.goods[props.providerOrgId] = productList.value;
    state.provider[props.providerOrgId] = props.providerOrgName;
  })
  shopCartAll.$patch(state => {
    state.userMap[userInfo.id] = shopCart;
  })
};

// 购物车弹窗调整
let openPop = () => {
  popup.value.open();
};

// 清除购物车
let cleanChart = () => {
  goodsMap.value = {};
  productList.value = [];
  shopCart.$patch(state => {
    state.goods[props.providerOrgId] = productList.value;
    state.provider[props.providerOrgId] = props.providerOrgName;
  })
  shopCartAll.$patch(state => {
    state.userMap[userInfo.id] = shopCart;
  })
  products.value.forEach((product) => {
    product.children.forEach((p) => {
      p.goodsList.forEach(g => {
        g.amount = null;
        g.orderNextNum = null;
        g.showMinus = false;
        g.inputDis = false;
      })
    })
  });
  goodsNum.value = 0;
  totalOrderPrice.value = 0;
}

// 调整下单页面
let goOrder = () => {
  useParam.$patch(state => {
    state.param = '';
  })
  uni.navigateTo({
    url: '/pages/customer/store/orderEntering?providerOrgId=' + props.providerOrgId + '&providerOrgName=' + props.providerOrgName,
    success: () => {
      uni.$once("refresh", (data) => {
      });
    },
  });
};

// 购物车小球样式
const ballRef = ref(null)
let fly = (event) => {
  if (!ballRef.value) return
  ballRef.value.action(event)
}

// 调整商品详细信息
let goProductDetails = (goods) => {
  uni.navigateTo({
    url: '/pages/customer/store/productDetail?id=' + goods.id + '&providerOrgId=' + props.providerOrgId + '&providerOrgName=' + props.providerOrgName,
  });
};

// 获取相似商品列表
let getSimilarGoodsList = (name) => {
  uni.navigateTo({
    url: '/pages/customer/store/productSimilarList?name=' + name + '&providerOrgId=' + props.providerOrgId,
  });
}

let similarGoods = ref({});
// 获取相似商品
let getSimilarGoodsNameNoTenantId = async (e) => {
  similarGoods.value = {};
  let form = {};
  form.createOrgId = props.providerOrgId;
  let res = await proxy.http.asyncPost(goodsApi.getSimilarGoodsNameNoTenantId, form, false);     // 获取店铺信息
  if (res.code === 0) {
    similarGoods.value = res.data;
  }
};

// 初始化数据
let inintData = () => {                 // 初始化数据
  goodsMap.value = {};                // 购物车中商品map
  goodsNum.value = null;            // 商品个数
  totalOrderPrice.value = 0;        // 总价钱
  productList.value = [];
  products.value = [];            // 商品信息
  provider = {};                  // 供应商信息
  getStoreData();
  getSimilarGoodsNameNoTenantId();  // 获取相似商品
}

/**
 * 属性
 * @param {productOneList}  一级菜单
 * @param {productTwoList} 二级菜单
 * @param {goodComList} 商品列表
 * @param {current} 索引ID
 * @param {productRef} 一级菜单ref
 * @param {jvlRef} 虚拟列表ref
 * @param {changeCurrent} 一级菜单索引
 * @param {direction} 滚动方向
 * @param {moreText} 加载提示
 * @param {refreshText} 刷新提示
 * @param {loadType} more加载状态
 * @param {scrollShow} 是否滚动触摸
 * @param {touchStartY} 触摸开始Y坐标
 * @param {isDrag} 是否拖动
 * */
let loadType = ref()
let moreText = ref('上滑加载更多数据')
let refreshText = ref('刷新成功')
let scrollShow = ref(false)
let productRef = ref();
let jvlRef = ref();
let goodComList = ref([])
let direction = ref('bottom')

let productOneList = ref([])
let productTwoList = computed(() => {
  let _list = productOneList.value[changeCurrent.value]
  return _list ? _list.children : [];
})
// 点击索引
let current = ref(0)
let tabsClick = (e) => {
  current.value = e.index;
}
// 索引改变
let tabsChange = (e) => {
  current.value = e.index;
  proxy.$refs.paging.reload();
  getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[e.index].id)
}

// 监听虚拟列表数组改变并赋值给virtualList进行重新渲染
function virtualListChange(vList) {
  goodComList.value = vList;
}

/**
 * 获取品类信息
 * @param providerOrgId 传递店铺ID
 * */
let getGoodsCategoryTreeBySupplierId = async () => {
  let res = await proxy.http.asyncPost(api.getGoodsCategoryTreeBySupplierId,
      props.providerOrgId//店铺ID
      , false);
  productOneList.value = res.data
  if (productOneList.value.length <= 0) {
    emptyVal.value = true
  }
  await getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[0].id)
  // await getGoodsListByCategoryId(res.data)
}
getGoodsCategoryTreeBySupplierId()

/**
 * 获取品类下的商品信息
 * @param createOrgId 传递店铺ID
 * @param goodsCategoryId 传递类目ID
 * */

let getGoodsListByCategoryId = async (createOrgId, goodsCategoryId) => {
  let res = await proxy.http.asyncPost(api.getGoodsListByCategoryId, {
    goodsCategoryId: goodsCategoryId,
    createOrgId: createOrgId,
    saleFlag: 1
  }, false);
  isDrag.value = false
  goodComList.value = res.data
  // proxy.$refs.paging.reload();//重载
  initShopCart()
  proxy.$refs.paging.setLocalPaging(res.data);
  // proxy.$refs.paging.endRefresh()// 结束刷新
}

// 点击一级菜单
let changeCurrent = ref(0)
let pagingReload = ref(false)
let changeTab = async (e) => {
  changeCurrent.value = e;
  current.value = 0;
  if (pagingReload.value) {
    proxy.$refs.paging.reload();
  }
  await getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[0].id)
  pagingReload.value = true
}
// 滚动到底部触发事件
let scrolltoupper = (e) => {

}
/**
 * 下拉加载上一条目
 **/
let pagIngRefresh = (e) => {
  if (typeof e !== "number" && isNaN(e)) return
  setTimeout(() => {
    if (current.value === 0) {
      if (changeCurrent.value > 0) {
        changeCurrent.value--
        productRef.value.clickHandler(changeCurrent.value)
        return;
      } else if (changeCurrent.value === 0) {
        refreshText.value = '已经到顶了'
        proxy.$refs.paging.endRefresh()
        return;
      }
    }
    current.value--
    proxy.$refs.paging.reload();
    getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[current.value].id)
  }, 500)
}

let pagIngLoad = (e) => {
  loadType.value = e
  // console.log('load状态===',e);
}
let pagIngScrollLower = (e) => {
  // console.log('底部触发===',e);
  if (loadType.value === 2 && scrollShow.value === true && (e === 'toBottom' || e === 'click')) {
    isDrag.value = true
    if (changeCurrent.value === productOneList.value.length - 1 && current.value === productTwoList.value.length - 1) {
      moreText.value = '已经到底了'
      return
    }
    moreText.value = '上滑加载更多数据'
  }
}
let touchDirectionChange = (e) => {
  // console.log('方向改变===',e);
}
let pagIngRefreshChange = (e) => {
  scrollShow.value = !(e !== 0);
  if (changeCurrent.value === 0 && current.value === 0) {
    return
  }
  console.log('刷新状态===', e);
}
let onRestore = (e) => {
  // console.log('恢复状态===',e);
}
let touchStartY = ref()
let isDrag = ref(false)

/**
 * 触摸开始
 **/
function touchStart(e) {
  // console.log("触摸开始")
  if (isDrag.value || goodComList.value.length <= 5) {
    touchStartY.value = e.touches[0].clientY;
  }
}

/**
 * 触摸滑动
 **/
function touchMove(e) {
  const moveY = e.touches[0].clientY;
  // this.touchDirection = moveY > touchStartY.value ? 'bottom' : 'top';
  const distance = moveY - touchStartY.value
}

/**
 * 触摸结束
 * 上拉加载更多
 **/
function touchEnd(e) {
  console.log("触摸结束")
  let deltaY = e.changedTouches[0].clientY - touchStartY.value;
  if (Math.abs(deltaY) > 100 && deltaY < 0 && loadType.value === 2 && scrollShow.value === true && (isDrag.value || goodComList.value.length <= 5)) {
    // moreText.value = '上滑加载更多数据'
    if (current.value === productTwoList.value.length - 1) {
      if (changeCurrent.value < productOneList.value.length - 1) {
        changeCurrent.value++
        productRef.value.clickHandler(changeCurrent.value)
        return;
      } else if (changeCurrent.value === productOneList.value.length - 1) {
        // moreText.value = '已经到底了'
        return;
      }
    }
    current.value++
    proxy.$refs.paging.reload();
    getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[current.value].id)
    // proxy.$refs.paging.endRefresh();
  }
}

// 按压滑动触发事件
// let refresher = proxy.axiosSetTime.debounce((e) => {
//   // 下拉加载上一条目
//   if (e === 'bottom') {
//     if (current.value === 0) {
//       if (changeCurrent.value > 0) {
//         changeCurrent.value--
//         productRef.value.clickHandler(changeCurrent.value)
//         jvlRef.value.refreshers()
//         return;
//       } else if (changeCurrent.value === 0) {
//         jvlRef.value.refreshers()
//         return;
//       }
//     }
//     current.value--
//     getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[current.value].id)
//     jvlRef.value.refreshers()
//     return
//   }
//   // 上拉加载下一条目
//   if (current.value === productTwoList.value.length - 1) {
//     if (changeCurrent.value < productOneList.value.length) {
//       changeCurrent.value++
//       productRef.value.clickHandler(changeCurrent.value)
//       jvlRef.value.refreshers()
//       return;
//     } else if (changeCurrent.value === productOneList.value.length) {
//       jvlRef.value.refreshers()
//       return;
//     }
//
//   } else if (changeCurrent.value === productOneList.value.length) {
//     jvlRef.value.refreshers();
//     return;
//   }
//   current.value++
//   getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[current.value].id)
//   jvlRef.value.refreshers()
// }, 1000)
/**
 * 显示store信息
 **/
let initShopCart = () => {
  productList.value = []
  let addGoodsList = shopCart.goods[props.providerOrgId];       // 获取缓存数据
  if (addGoodsList != null && addGoodsList.length > 0) {
    addGoodsList.forEach(item => {
      goodsMap.value[item.id] = item;
    });
  }
  goodComList.value.forEach((p) => {
    if (goodsMap.value[p.id]) {
      p.amount = goodsMap.value[p.id].amount;
      p.orderNextNum = goodsMap.value[p.id].orderNextNum;
      p.showMinus = goodsMap.value[p.id].showMinus;
      p.inputDis = goodsMap.value[p.id].inputDis;
    } else {
      p.amount = null;
      p.orderNextNum = null;
      p.showMinus = false;
      p.inputDis = false;
    }
  })
  goodsNum.value = Object.keys(goodsMap.value).length;
  totalOrderPrice.value = 0;

  Object.keys(goodsMap.value).forEach(key => {
    totalOrderPrice.value = proxy.cal.add(totalOrderPrice.value, proxy.cal.multiply(goodsMap.value[key].price, goodsMap.value[key].amount));
    productList.value.push(goodsMap.value[key]);
  });
  totalOrderPrice.value = Math.round(totalOrderPrice.value * 100) / 100;
  // console.log(shopCart.goods[props.providerOrgId]);//购物车信息
}

onShow(() => {
  // inintData();
  if (!productTwoList.value[current.value]) return
  initShopCart()
  // getGoodsListByCategoryId(props.providerOrgId, productTwoList.value[current.value].id)
});
onMounted(() => {

})
</script>
<style scoped lang="scss">
.right-title {
  padding: 20rpx 0 0 24rpx;
  color: var(--uni-text-input-color);
  font-size: var(--uni-font-size-14);
}

.right-product-box {
  display: flex;
  justify-content: flex-start;
  width: calc(100% - 48rpx);
  margin: 64rpx auto 32rpx;

  &:first-child {
    margin: 32rpx auto 32rpx;
  }

  .image-box {
    border-radius: 16rpx;
    width: 200rpx;
    height: 200rpx;
    flex-shrink: 0;
    overflow: hidden;

    & > uni-image {
      width: 100%;
      height: 100%;
    }
  }

  .name-box {
    padding-left: 16rpx;
    flex-direction: column;
    display: flex;
    flex: 1;

    .good-name {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .similar-good {
      color: #3775F6;
      width: 40%;
      font-size: 14px;
    }

    .h2 {
      font-weight: 600;
      font-size: var(--uni-font-size-16);
      line-height: 48rpx;
      word-break: break-all;
    }

    .list-no {
      height: 80vh;
      margin-left: 5%;
      margin-right: 5%;
      border-radius: 20rpx;
      background-color: #fff;
    }


    .specif-text {
      font-size: var(--uni-font-size-12);
      color: var(--uni-text-input-color);
      flex: 1;
      padding-top: 8rpx;
    }

    .price-box {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;

      .price {
        display: flex;
        align-items: baseline;
        color: var(--uni-text-color-red);
        font-size: var(--uni-font-size-12);
        font-weight: 600;

        & > text {
          font-size: var(--uni-font-size-16);
          padding-left: 8rpx;
        }
      }

      .disable-text {
        font-size: var(--uni-font-size-12);
        color: var(--uni-text-color-red);
      }
    }
  }
}

.popup-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 38rpx 24rpx 0;

  .h2 {
    font-size: var(--uni-font-size-16);
  }

  .clear-shopping {
    @include flex-center;

    & > .text {
      font-size: var(--uni-font-size-14);
      color: var(--uni-text-input-color);
      line-height: 1;
      padding-left: 8rpx;
    }
  }
}

.popup-height {
  height: 956rpx;
}

.item:last-child {
  //padding-bottom: 150rpx;
}
</style>